package com.changgou.service.goods.service.impl;

import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changgou.goods.pojo.CategoryBrand;
import com.changgou.service.goods.dao.CategoryBrandMapper;
import com.changgou.service.goods.service.CategoryBrandService;
import org.springframework.stereotype.Service;

/**
 * Package: com.changgou.service.goods.service.impl
 * ClassName: CategoryBrandServiceImpl
 * Description:
 *
 * @Author : 福森森
 * @Create : 2024/8/28 20:59
 */
@Service
public class CategoryBrandServiceImpl extends ServiceImpl<CategoryBrandMapper, CategoryBrand> implements CategoryBrandService {
    @Override
    public int findByObjAndGetNum(CategoryBrand categoryBrand) {
        Long count = this.lambdaQuery()
                .eq(CategoryBrand::getCategoryId, categoryBrand.getCategoryId())
                .eq(CategoryBrand::getBrandId, categoryBrand.getBrandId())
                .count();
        return Convert.toInt(count);
    }
}
